+Sun Apr 14 16:56:59 2002 Kristian Rietveld <kris@gtk.org>
+
+ * gtk/gtktreeprivate.h: add _gtk_tree_view_column_get_editable_cell and
+ _gtk_tree_view_column_get_neighbor_sizes
+
+ * gtk/gtktreeviewcolumn.c (struct _GtkTreeViewColumnCellInfo): add
+ real_width field,
+ (_gtk_tree_view_column_get_editable_cell): implement,
+ (gtk_tree_view_column_cell_process_action): fill info->real_width
+ (_gtk_tree_view_column_get_neighbor_sizes): implement
+
+ * gtk/gtktreeview.c (gtk_tree_view_button_press): make the "editable
+ widget" show up with the same size as the actual cell, so it doesnt
+ cover the complete column if there are any other cells in that column.
+
2002-04-14 Abigail Brady <morwen@evilmagic.org>
* gtk/gtkfilesel.c: Fix typo in message.
+Sun Apr 14 16:56:59 2002 Kristian Rietveld <kris@gtk.org>
+
+ * gtk/gtktreeprivate.h: add _gtk_tree_view_column_get_editable_cell and
+ _gtk_tree_view_column_get_neighbor_sizes
+
+ * gtk/gtktreeviewcolumn.c (struct _GtkTreeViewColumnCellInfo): add
+ real_width field,
+ (_gtk_tree_view_column_get_editable_cell): implement,
+ (gtk_tree_view_column_cell_process_action): fill info->real_width
+ (_gtk_tree_view_column_get_neighbor_sizes): implement
+
+ * gtk/gtktreeview.c (gtk_tree_view_button_press): make the "editable
+ widget" show up with the same size as the actual cell, so it doesnt
+ cover the complete column if there are any other cells in that column.
+
2002-04-14 Abigail Brady <morwen@evilmagic.org>
* gtk/gtkfilesel.c: Fix typo in message.
+Sun Apr 14 16:56:59 2002 Kristian Rietveld <kris@gtk.org>
+
+ * gtk/gtktreeprivate.h: add _gtk_tree_view_column_get_editable_cell and
+ _gtk_tree_view_column_get_neighbor_sizes
+
+ * gtk/gtktreeviewcolumn.c (struct _GtkTreeViewColumnCellInfo): add
+ real_width field,
+ (_gtk_tree_view_column_get_editable_cell): implement,
+ (gtk_tree_view_column_cell_process_action): fill info->real_width
+ (_gtk_tree_view_column_get_neighbor_sizes): implement
+
+ * gtk/gtktreeview.c (gtk_tree_view_button_press): make the "editable
+ widget" show up with the same size as the actual cell, so it doesnt
+ cover the complete column if there are any other cells in that column.
+
2002-04-14 Abigail Brady <morwen@evilmagic.org>
* gtk/gtkfilesel.c: Fix typo in message.
+Sun Apr 14 16:56:59 2002 Kristian Rietveld <kris@gtk.org>
+
+ * gtk/gtktreeprivate.h: add _gtk_tree_view_column_get_editable_cell and
+ _gtk_tree_view_column_get_neighbor_sizes
+
+ * gtk/gtktreeviewcolumn.c (struct _GtkTreeViewColumnCellInfo): add
+ real_width field,
+ (_gtk_tree_view_column_get_editable_cell): implement,
+ (gtk_tree_view_column_cell_process_action): fill info->real_width
+ (_gtk_tree_view_column_get_neighbor_sizes): implement
+
+ * gtk/gtktreeview.c (gtk_tree_view_button_press): make the "editable
+ widget" show up with the same size as the actual cell, so it doesnt
+ cover the complete column if there are any other cells in that column.
+
2002-04-14 Abigail Brady <morwen@evilmagic.org>
* gtk/gtkfilesel.c: Fix typo in message.
+Sun Apr 14 16:56:59 2002 Kristian Rietveld <kris@gtk.org>
+
+ * gtk/gtktreeprivate.h: add _gtk_tree_view_column_get_editable_cell and
+ _gtk_tree_view_column_get_neighbor_sizes
+
+ * gtk/gtktreeviewcolumn.c (struct _GtkTreeViewColumnCellInfo): add
+ real_width field,
+ (_gtk_tree_view_column_get_editable_cell): implement,
+ (gtk_tree_view_column_cell_process_action): fill info->real_width
+ (_gtk_tree_view_column_get_neighbor_sizes): implement
+
+ * gtk/gtktreeview.c (gtk_tree_view_button_press): make the "editable
+ widget" show up with the same size as the actual cell, so it doesnt
+ cover the complete column if there are any other cells in that column.
+
2002-04-14 Abigail Brady <morwen@evilmagic.org>
* gtk/gtkfilesel.c: Fix typo in message.
+Sun Apr 14 16:56:59 2002 Kristian Rietveld <kris@gtk.org>
+
+ * gtk/gtktreeprivate.h: add _gtk_tree_view_column_get_editable_cell and
+ _gtk_tree_view_column_get_neighbor_sizes
+
+ * gtk/gtktreeviewcolumn.c (struct _GtkTreeViewColumnCellInfo): add
+ real_width field,
+ (_gtk_tree_view_column_get_editable_cell): implement,
+ (gtk_tree_view_column_cell_process_action): fill info->real_width
+ (_gtk_tree_view_column_get_neighbor_sizes): implement
+
+ * gtk/gtktreeview.c (gtk_tree_view_button_press): make the "editable
+ widget" show up with the same size as the actual cell, so it doesnt
+ cover the complete column if there are any other cells in that column.
+
2002-04-14 Abigail Brady <morwen@evilmagic.org>
* gtk/gtkfilesel.c: Fix typo in message.
GtkCellEditable *editable_widget);
void _gtk_tree_view_column_stop_editing (GtkTreeViewColumn *tree_column);
void _gtk_tree_view_install_mark_rows_col_dirty (GtkTreeView *tree_view);
-gboolean _gtk_tree_view_column_has_editable_cell (GtkTreeViewColumn *column);
+gboolean _gtk_tree_view_column_has_editable_cell (GtkTreeViewColumn *column);
+GtkCellRenderer *_gtk_tree_view_column_get_editable_cell (GtkTreeViewColumn *column);
GtkTreeSelection* _gtk_tree_selection_new (void);
GtkTreeSelection* _gtk_tree_selection_new_with_tree_view (GtkTreeView *tree_view);
guint flags);
void _gtk_tree_view_column_cell_set_dirty (GtkTreeViewColumn *tree_column,
gboolean install_handler);
+void _gtk_tree_view_column_get_neighbor_sizes (GtkTreeViewColumn *column,
+ GtkCellRenderer *cell,
+ gint *left,
+ gint *right);
#ifdef __cplusplus
tree_view->priv->cursor)
{
GtkTreePath *cursor = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
+ GtkTreeIter iter;
+
+ gtk_tree_model_get_iter (tree_view->priv->model, &iter, path);
+ gtk_tree_view_column_cell_set_cell_data (column,
+ tree_view->priv->model,
+ &iter,
+ GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT),
+ node->children?TRUE:FALSE);
if ((cursor && !gtk_tree_path_compare (cursor, path))
|| !_gtk_tree_view_column_has_editable_cell (column))
/* FIXME: get the right flags */
guint flags = 0;
- GtkTreeIter iter;
-
- gtk_tree_model_get_iter (tree_view->priv->model, &iter, path);
- gtk_tree_view_column_cell_set_cell_data (column,
- tree_view->priv->model,
- &iter,
- GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT),
- node->children?TRUE:FALSE);
path_string = gtk_tree_path_to_string (path);
{
if (cell_editable != NULL)
{
+ gint left, right;
+ GdkRectangle area;
+
+ area = cell_area;
+ _gtk_tree_view_column_get_neighbor_sizes (column, _gtk_tree_view_column_get_editable_cell (column), &left, &right);
+
+ area.x += left;
+ area.width -= right + left;
+
gtk_tree_view_real_start_editing (tree_view,
column,
path,
cell_editable,
- &cell_area,
+ &area,
(GdkEvent *)event,
flags);
gtk_tree_path_free (path);
if (cursor)
gtk_tree_path_free (cursor);
}
+
/* select */
pre_val = tree_view->priv->vadjustment->value;
gpointer func_data;
GtkDestroyNotify destroy;
gint requested_width;
+ gint real_width;
guint expand : 1;
guint pack : 1;
guint has_focus : 1;
return FALSE;
}
+GtkCellRenderer *
+_gtk_tree_view_column_get_editable_cell (GtkTreeViewColumn *column)
+{
+ GList *list;
+
+ for (list = column->cell_list; list; list = list ->next)
+ if (((GtkTreeViewColumnCellInfo *)list->data)->cell->mode ==
+ GTK_CELL_RENDERER_MODE_EDITABLE)
+ return ((GtkTreeViewColumnCellInfo *)list->data)->cell;
+
+ return NULL;
+}
+
/* Public Functions */
real_cell_area.width = info->requested_width +
(info->expand?extra_space:0);
+ info->real_width = real_cell_area.width;
real_cell_area.x += focus_line_width;
if (action == CELL_ACTION_RENDER)
{
real_cell_area.width = info->requested_width +
(info->expand?extra_space:0);
+ info->real_width = real_cell_area.width;
if (action == CELL_ACTION_RENDER)
{
gtk_cell_renderer_render (info->cell,
tree_column->editable_widget = NULL;
}
+
+void
+_gtk_tree_view_column_get_neighbor_sizes (GtkTreeViewColumn *column,
+ GtkCellRenderer *cell,
+ gint *left,
+ gint *right)
+{
+ GList *list;
+
+ if (left)
+ {
+ *left = 0;
+
+ for (list = column->cell_list; list; list = list->next)
+ {
+ GtkTreeViewColumnCellInfo *info =
+ (GtkTreeViewColumnCellInfo *)list->data;
+
+ if (info->cell == cell)
+ break;
+
+ *left += info->real_width;
+ }
+ }
+
+ if (right)
+ {
+ *right = 0;
+
+ for (list = column->cell_list; list; list = list->next)
+ {
+ GtkTreeViewColumnCellInfo *info =
+ (GtkTreeViewColumnCellInfo *)list->data;
+
+ if (info->cell == cell)
+ break;
+ }
+
+ /* skip cell */
+ if (list && list->next)
+ {
+ list = list->next;
+ for ( ; list; list = list->next)
+ {
+ GtkTreeViewColumnCellInfo *info =
+ (GtkTreeViewColumnCellInfo *)list->data;
+
+ *right += info->real_width;
+ }
+ }
+ }
+}